/**
 * Licensee: andres orellana
 * License Type: Evaluation
 */
package ormsamples;

import org.orm.*;
public class CreatePinPassData {
	public void createTestData() throws PersistentException {
		PersistentTransaction t = orm.PinPassPersistentManager.instance().getSession().beginTransaction();
		try {
			orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
			orm.dao.CoordenadaDAO lormCoordenadaDAO = lDAOFactory.getCoordenadaDAO();
			orm.Coordenada lormCoordenada = lormCoordenadaDAO.createCoordenada();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : clientecli, coo_valor, coo_fila, coo_letra
			lormCoordenadaDAO.save(lormCoordenada);
			orm.dao.LogDAO lormLogDAO = lDAOFactory.getLogDAO();
			orm.Log lormLog = lormLogDAO.createLog();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : clientecli, log_resultado, log_contador, log_fecha
			lormLogDAO.save(lormLog);
			orm.dao.ClienteDAO lormClienteDAO = lDAOFactory.getClienteDAO();
			orm.Cliente lormCliente = lormClienteDAO.createCliente();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : log, coordenada, cli_id_tarjeta, cli_nombre
			lormClienteDAO.save(lormCliente);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public static void main(String[] args) {
		try {
			CreatePinPassData createPinPassData = new CreatePinPassData();
			try {
				createPinPassData.createTestData();
			}
			finally {
				orm.PinPassPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
